package com.ed.controller;

import com.ed.result.Result;
import com.ed.service.DataScreenService;
import com.ed.vo.DataScreenVo;
import com.ed.vo.LatestActivityVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 管理员数据总览
 */
@RestController
@Slf4j
@CrossOrigin
@RequestMapping("/dataScreen")
public class DataScreenController {
    @Autowired
    private DataScreenService dataScreenService;
    @GetMapping("/listData")
    public Result<DataScreenVo> listData(){
        DataScreenVo res = dataScreenService.listData();
        return Result.success(res);
    }
    @GetMapping("/latestActivities")
    public Result<List<LatestActivityVo>> latestActivities(){
        List<LatestActivityVo> res = dataScreenService.latestActivities();
        return Result.success(res);
    }
}
